from bs4 import BeautifulSoup
import requests
import json

url = 'https://cd.ke.com/ershoufang/jinjiang/pg1'
headers = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36'
}
response = requests.get(url, headers=headers)
soup = BeautifulSoup(response.content, 'html.parser')
haveNext = True

a = soup.find('div', class_='page-box house-lst-page-box')['page-data']
b = eval(a)
aaa = b['totalPage']
for x in soup.find('div', class_='contentBottom').findAll('a'):
    try:
        if x.text == '下一页':
            haveNext = True
        else:
            haveNext = False
    except Exception as e:
        pass
print(haveNext)
